//
//  movierViewController.m
//  简单豆瓣不得不交版 1 带
//
//  Created by dllo on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "movierViewController.h"



@interface movierViewController ()


@end

@implementation movierViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
        // Do any additional setup after loading the view.
    
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 44)];
    titleLabel.font = [UIFont boldSystemFontOfSize:20];
    titleLabel.textColor = [UIColor blackColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"电影";
    self.navigationItem.titleView = titleLabel;
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:0.3490 green:0.6118 blue:0.6706 alpha:1.000]];
    
      //将第二个页面设置成为子视图
    self.jiuView  = [[JiuViewController alloc]init];
    [self addChildViewController:self.jiuView];
    [_jiuView release];
    [self.view addSubview:self.jiuView.view];
    
    
    //将第一个页面设置成为子视图
    self.Two2View  = [[Two2ViewController alloc]init];
    [self addChildViewController:self.Two2View];
    [_Two2View release];
    //将子视图的页面在self.view的页面显示
    [self.view addSubview:self.Two2View.view];
    
    self.booll = NO;
    
    
    self.navigationItem.rightBarButtonItem  = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_nav_collection@2x.png"] style:UIBarButtonItemStylePlain target:self action:@selector(rightActionone:)];
    
    self.booll = YES;
    
}


//方法
-(void)rightActionone:(UIBarButtonItem *)item{
    if (self.booll == YES) {
        [self.view bringSubviewToFront:self.jiuView.view];
        self.booll = NO;
        [self.navigationItem.rightBarButtonItem setImage:[UIImage imageNamed:@"btn_nav_list@2x.png"]];
        
        
        
    }else{
 
        
        [self.view bringSubviewToFront:self.Two2View.view];
        self.booll = YES;
        [self.navigationItem.rightBarButtonItem setImage:[UIImage imageNamed:@"btn_nav_collection@2x.png"]];
        
        
        
    }
    
    
    
    
    
}















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
